import matrix.Matrix;

/**
 * Created by aleks_000 on 17.12.13.
 */
public class MatrixValidation {
    public static boolean isEmpty(Matrix matrix) {
        for (int row = 0; row < matrix.getRowCount(); ++row) {
            for (int column = 0; column < matrix.getColumnCount(); ++column) {
                if (matrix.getValue(row, column) != 0.0) {
                    return false;
                }
            }
        }
        return true;
    }

    public static boolean isIdentity(Matrix matrix) {
        for (int row = 0; row < matrix.getRowCount(); ++row) {
            for (int column = 0; column < matrix.getColumnCount(); ++column) {
                if (column == row) {
                    if (matrix.getValue(row, column) != 1.0) {
                        return false;
                    }
                } else {
                    if (matrix.getValue(row, column) != 0.0) {
                        return false;
                    }
                }

            }
        }
        return true;
    }
}
